<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>Pandas数据规整-清理 | Python 数据分析学习目录</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../数据分析库的操作/11Pandas数据规整-转换.html" />
    
    
    <link rel="prev" href="../数据分析库的操作/9Pandas分组聚合2.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="4.4.6"
        data-chapter-title="Pandas数据规整-清理"
        data-filepath="数据分析库的操作/10Pandas数据规整-清理.md"
        data-basepath=".."
        data-revision="Wed Oct 24 2018 21:30:49 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        数据分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="Python数据分析序言/内容序言.html">
            
                
                    <a href="../Python数据分析序言/内容序言.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        Python数据分析内容
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2" data-path="python数据分析环境和工具/Python数据分析相关.html">
            
                
                    <a href="../python数据分析环境和工具/Python数据分析相关.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        python数据分析环境和工具
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="python数据分析环境和工具/1Python数据课程软件和环境安装.html">
            
                
                    <a href="../python数据分析环境和工具/1Python数据课程软件和环境安装.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        Python数据课程 软件和环境安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="python数据分析环境和工具/2python发行版.html">
            
                
                    <a href="../python数据分析环境和工具/2python发行版.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        python发行版
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="python数据分析环境和工具/5交互式编辑器-JupyterNotebook.html">
            
                
                    <a href="../python数据分析环境和工具/5交互式编辑器-JupyterNotebook.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        交互式编辑器-JupyterNotebook
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="python数据分析环境和工具/5.1Jupyter-notebook拓展应用.html">
            
                
                    <a href="../python数据分析环境和工具/5.1Jupyter-notebook拓展应用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.1.</b>
                        
                        Jupyter-notebook拓展应用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="python数据分析环境和工具/包和环境管理器：conda.html">
            
                
                    <a href="../python数据分析环境和工具/包和环境管理器：conda.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        包和环境管理器：conda
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="python数据分析环境和工具/pip和Virtualenv.html">
            
                
                    <a href="../python数据分析环境和工具/pip和Virtualenv.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.1.</b>
                        
                        pip和Virtualenv
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="python数据分析环境和工具/3Markdown.html">
            
                
                    <a href="../python数据分析环境和工具/3Markdown.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        标记语言：Markdown
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="python数据分析环境和工具/4Markdown语法.html">
            
                
                    <a href="../python数据分析环境和工具/4Markdown语法.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.1.</b>
                        
                        Markdown语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5.2" data-path="python数据分析环境和工具/6Gitbook文档.html">
            
                
                    <a href="../python数据分析环境和工具/6Gitbook文档.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.2.</b>
                        
                        文档管理工具-Gitbook
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="数据分析库的初步认识/index.html">
            
                
                    <a href="../数据分析库的初步认识/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        数据分析库-Pandas
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="数据分析库的初步认识/Pandas创建.html">
            
                
                    <a href="../数据分析库的初步认识/Pandas创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        pandas
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="数据分析库的初步认识/Series创建.html">
            
                
                    <a href="../数据分析库的初步认识/Series创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        Series
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="数据分析库的初步认识/DataFrame创建.html">
            
                
                    <a href="../数据分析库的初步认识/DataFrame创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        DataFrame对象-创建
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" >
            
            <span><b>4.</b> 数据分析库的操作</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="数据分析库的操作/1DataFrame查询1-整体.html">
            
                
                    <a href="../数据分析库的操作/1DataFrame查询1-整体.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        DataFrame查询1-整体
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="数据分析库的操作/2DataFrame查询2-专用查询.html">
            
                
                    <a href="../数据分析库的操作/2DataFrame查询2-专用查询.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        DataFrame查询2-专用查询
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="数据分析库的操作/3DataFrame查询3-专有查询：过滤查询.html">
            
                
                    <a href="../数据分析库的操作/3DataFrame查询3-专有查询：过滤查询.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        DataFrame查询3-专有查询：过滤查询
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="数据分析库的操作/4Pandas对象的数据操作：增删改查.html">
            
                
                    <a href="../数据分析库的操作/4Pandas对象的数据操作：增删改查.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        Pandas对象的数据操作：增删改查
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.4.1" data-path="数据分析库的操作/5Pandas数据操作：其他操作.html">
            
                
                    <a href="../数据分析库的操作/5Pandas数据操作：其他操作.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.1.</b>
                        
                        Pandas数据操作：其他操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4.2" data-path="数据分析库的操作/6Pandas数据存取.html">
            
                
                    <a href="../数据分析库的操作/6Pandas数据存取.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.2.</b>
                        
                        Pandas数据存取
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4.3" data-path="数据分析库的操作/7Pandas数据运算.html">
            
                
                    <a href="../数据分析库的操作/7Pandas数据运算.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.3.</b>
                        
                        Pandas数据运算
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.4.3.1" data-path="数据分析库的操作/7.1Pandas数据运算拓展.html">
            
                
                    <a href="../数据分析库的操作/7.1Pandas数据运算拓展.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.3.1.</b>
                        
                        Pandas数据运算-拓展
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.4.4" data-path="数据分析库的操作/8Pandas分组聚合1.html">
            
                
                    <a href="../数据分析库的操作/8Pandas分组聚合1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.4.</b>
                        
                        Pandas分组聚合1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4.5" data-path="数据分析库的操作/9Pandas分组聚合2.html">
            
                
                    <a href="../数据分析库的操作/9Pandas分组聚合2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.5.</b>
                        
                        Pandas分组聚合2
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="4.4.6" data-path="数据分析库的操作/10Pandas数据规整-清理.html">
            
                
                    <a href="../数据分析库的操作/10Pandas数据规整-清理.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.6.</b>
                        
                        Pandas数据规整-清理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4.7" data-path="数据分析库的操作/11Pandas数据规整-转换.html">
            
                
                    <a href="../数据分析库的操作/11Pandas数据规整-转换.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.7.</b>
                        
                        Pandas数据规整-转换
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.4.7.1" data-path="数据分析库的操作/14Pandas数据规整-转换-离散化和面元划分.html">
            
                
                    <a href="../数据分析库的操作/14Pandas数据规整-转换-离散化和面元划分.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.7.1.</b>
                        
                        离散化和面元划分
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.4.8" data-path="数据分析库的操作/16Pandas数据规整-合并.html">
            
                
                    <a href="../数据分析库的操作/16Pandas数据规整-合并.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.8.</b>
                        
                        Pandas数据规整-合并
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="数据分析库的操作/13Pandas数据规整-重塑和轴向旋转.html">
            
                
                    <a href="../数据分析库的操作/13Pandas数据规整-重塑和轴向旋转.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        Pandas数据规整-重塑和轴向旋转
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.5.1" data-path="数据分析库的操作/13.1透视表和交叉表.html">
            
                
                    <a href="../数据分析库的操作/13.1透视表和交叉表.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.1.</b>
                        
                        透视表和交叉表
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="Python可视化/绘图库-Matplotlib.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        Python可视化
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="Python可视化/绘图库-Matplotlib/Matplotlib常见图表.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/Matplotlib常见图表.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        基础：Matplotlib常见图表
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.1" data-path="Python可视化/绘图库-Matplotlib/Matplotlib常见设置和操作.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/Matplotlib常见设置和操作.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.1.</b>
                        
                        Matplotlib常见设置和操作
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="Python可视化/绘图库-Matplotlib/1Matplotlib-绘图区域.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/1Matplotlib-绘图区域.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        提升：绘图区域
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="Python可视化/绘图库-Matplotlib/2Matplotlib-图像组件.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/2Matplotlib-图像组件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        提升：绘图组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="Python可视化/绘图库-Matplotlib/3Matplotlib-高级绘图.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/3Matplotlib-高级绘图.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        拓展：高级绘图
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="Python可视化/绘图库-Matplotlib/4数学计算展示图像.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/4数学计算展示图像.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        拓展：数学计算展示图像
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="Python可视化/绘图库-Matplotlib/5注意事项.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/5注意事项.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.6.</b>
                        
                        拓展：注意事项
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="Python可视化/绘图库-Matplotlib/6pylab.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/6pylab.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.7.</b>
                        
                        拓展：pylab
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="数据分析必备知识点/数据分析必备知识点汇集.html">
            
                
                    <a href="../数据分析必备知识点/数据分析必备知识点汇集.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        数据分析必备知识点
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7" data-path="数据分析必备知识点/数据分析流程.html">
            
                
                    <a href="../数据分析必备知识点/数据分析流程.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        数据分析流程
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >Python 数据分析学习目录</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h2 id="&#x6570;&#x636E;&#x89C4;&#x6574;&#xFF08;&#x6570;&#x636E;&#x9884;&#x5904;&#x7406;&#xFF0C;&#x6570;&#x636E;&#x6E05;&#x6D17;&#xFF09;">&#x6570;&#x636E;&#x89C4;&#x6574;&#xFF08;&#x6570;&#x636E;&#x9884;&#x5904;&#x7406;&#xFF0C;&#x6570;&#x636E;&#x6E05;&#x6D17;&#xFF09;</h2>
<p>&#x6570;&#x636E;&#x89C4;&#x6574;&#x7684;&#x4E00;&#x822C;&#x5206;&#x7C7B;&#xFF1A;</p>
<ul>
<li>&#x6E05;&#x7406;</li>
<li>&#x8F6C;&#x6362;</li>
<li>&#x5408;&#x5E76;</li>
<li>&#x91CD;&#x5851;</li>
</ul>
<hr>
<h1 id="pandas&#x6570;&#x636E;&#x89C4;&#x6574;&#x6E05;&#x7406;&#xFF1A;">Pandas&#x6570;&#x636E;&#x89C4;&#x6574;-&#x6E05;&#x7406;&#xFF1A;</h1>
<p>&#x5BF9;&#x6307;&#x5B9A;&#x6570;&#x636E;&#xFF08;&#x5982;&#x7F3A;&#x5931;&#x6570;&#x636E;&#x3001;&#x91CD;&#x590D;&#x6570;&#x636E;&#xFF09;&#x8FDB;&#x884C;&#x5904;&#x7406;&#xFF08;&#x68C0;&#x67E5;&#x3001;&#x66FF;&#x6362;&#x3001;&#x5220;&#x9664;&#xFF09;</p>
<ul>
<li>&#x7F3A;&#x5931;&#x503C;&#x7684;&#x8868;&#x793A;&#xFF1A;np.nan</li>
<li>&#x68C0;&#x67E5;&#x7F3A;&#x5931;&#x503C;&#xFF1A;isnull(),notnull(),info()</li>
<li>&#x5220;&#x9664;&#x7F3A;&#x5931;&#x503C;&#xFF1A; dropna()</li>
<li>&#x586B;&#x5145;&#x7F3A;&#x5931;&#x503C;: fillna()</li>
<li>&#x66FF;&#x6362;&#x503C;&#xFF08;&#x586B;&#x5145;&#x7F3A;&#x5931;&#x503C;&#x662F;&#x66FF;&#x6362;&#x503C;&#x7684;&#x4E00;&#x79CD;&#x60C5;&#x51B5;&#xFF09;&#xFF1A;replace().</li>
</ul>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
</code></pre>
<h1 id="pandas&#x7F3A;&#x5931;&#x6570;&#x636E;&#x5904;&#x7406;">Pandas&#x7F3A;&#x5931;&#x6570;&#x636E;&#x5904;&#x7406;</h1>
<p>&#x7F3A;&#x5931;&#x503C;&#x8868;&#x793A;</p>
<pre><code class="lang-python">
a = np.array([<span class="hljs-number">2</span>,<span class="hljs-number">4</span>,<span class="hljs-number">8</span>,<span class="hljs-number">10</span>,<span class="hljs-number">12</span>])
a
</code></pre>
<pre><code>array([ 2,  4,  8, 10, 12])
</code></pre><pre><code class="lang-python">a + <span class="hljs-number">10</span>
</code></pre>
<pre><code>array([12, 14, 18, 20, 22])
</code></pre><p><strong>python  &#x539F;&#x751F;&#x7F3A;&#x5931;&#x503C;&#x8868;&#x793A;&#xFF1A;None</strong></p>
<p>&#x7F3A;&#x5931;&#x503C;&#x5143;&#x7D20;&#x5BFC;&#x81F4;&#x8BA1;&#x7B97;&#x62A5;&#x9519;</p>
<pre><code class="lang-python">b = np.array([<span class="hljs-number">2</span>,<span class="hljs-number">4</span>,<span class="hljs-keyword">None</span>,<span class="hljs-number">10</span>,<span class="hljs-number">12</span>])
b
</code></pre>
<pre><code>array([2, 4, None, 10, 12], dtype=object)
</code></pre><pre><code class="lang-python">b + <span class="hljs-number">10</span>  <span class="hljs-comment">#&#x7F3A;&#x5931;&#x503C;&#x5BFC;&#x81F4;&#x8BA1;&#x7B97;&#x62A5;&#x9519;</span>
</code></pre>
<pre><code>---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

&lt;ipython-input-16-c6d5a276d5e4&gt; in &lt;module&gt;()
----&gt; 1 b + 10  #&#x7F3A;&#x5931;&#x503C;&#x5BFC;&#x81F4;&#x8BA1;&#x7B97;&#x62A5;&#x9519;


TypeError: unsupported operand type(s) for +: &apos;NoneType&apos; and &apos;int&apos;
</code></pre><h3 id="&#x4F7F;&#x7528;numpy&#x7684;&#x7F3A;&#x5931;&#x503C;&#x6570;&#x636E;&#x7C7B;&#x578B;-&#xFF1A;-npnan">&#x4F7F;&#x7528;Numpy&#x7684;&#x7F3A;&#x5931;&#x503C;&#x6570;&#x636E;&#x7C7B;&#x578B; &#xFF1A; np.nan</h3>
<p>&#x7F3A;&#x5931;&#x503C;&#x8FD0;&#x7B97;&#x4E0D;&#x4F1A;&#x62A5;&#x9519;&#xFF0C;&#x548C;&#x7F3A;&#x5931;&#x503C;&#x8FD0;&#x7B97;&#xFF0C;&#x7ED3;&#x679C;&#x8FD8;&#x662F;&#x7F3A;&#x5931;&#x503C;</p>
<pre><code class="lang-python">c = np.array([<span class="hljs-number">2</span>,<span class="hljs-number">4</span>,np.nan,<span class="hljs-number">10</span>,<span class="hljs-number">12</span>])
c
</code></pre>
<pre><code>array([ 2.,  4., nan, 10., 12.])
</code></pre><pre><code class="lang-python">c + <span class="hljs-number">10</span>  <span class="hljs-comment">#&#x8BA1;&#x7B97;&#x65F6;&#x4E0D;&#x4F1A;&#x62A5;&#x9519;</span>
</code></pre>
<pre><code>array([12., 14., nan, 20., 22.])
</code></pre><pre><code class="lang-python">
c.sum()  <span class="hljs-comment">#&#x4EFB;&#x4F55;&#x6570;&#x7EC4;&#x548C;&#x7F3A;&#x5931;&#x503C;&#x8BA1;&#x7B97;&#xFF0C;&#x7ED3;&#x679C;&#x8FD8;&#x662F;&#x7F3A;&#x5931;&#x503C;</span>
</code></pre>
<pre><code>nan
</code></pre><pre><code class="lang-python">np.sum(c)
</code></pre>
<pre><code>nan
</code></pre><p>nan&#x4E13;&#x6709;&#x8FD0;&#x7B97;&#x65B9;&#x6CD5;&#xFF0C;&#x4F1A;&#x8DF3;&#x8FC7;&#x7F3A;&#x5931;&#x503C;&#xFF0C;&#x76F4;&#x63A5;&#x8BA1;&#x7B97;&#x6B63;&#x5E38;&#x503C;</p>
<pre><code class="lang-python">np.nansum(c)
</code></pre>
<pre><code>28.0
</code></pre><h3 id="&#x4F7F;&#x7528;pandas&#x7F3A;&#x5931;&#x503C;-&#x8BA1;&#x7B97;">&#x4F7F;&#x7528;Pandas&#x7F3A;&#x5931;&#x503C; &#x8BA1;&#x7B97;</h3>
<p>Pandas&#x4E2D;&#xFF0C;&#x4E0D;&#x8BBA;&#x7F3A;&#x5931;&#x503C;&#x662F;None &#x8FD8;&#x662F;np.nan,&#x90FD;&#x4F1A;&#x88AB;&#x8F6C;&#x5316;&#x4E3A;NaN&#x7684;&#x5F62;&#x5F0F;</p>
<p>NaN&#xFF1A;&#x975E;&#x6570;&#x5B57;&#xFF0C;not a number, Pandas &#x4E2D;&#x5B83;&#x8868;&#x793A;&#x7F3A;&#x5931;&#x6216;NA&#x503C;&#xFF0C;&#x4FBF;&#x4E8E;&#x88AB;&#x68C0;&#x6D4B;&#x51FA;&#x6765;&#x3002;</p>
<p>&#x672C;&#x8D28;&#x4E0A;&#x5C31;&#x662F;np.nan&#x3002;</p>
<p>pandas &#x5BF9;&#x8C61;&#x53EF;&#x4EE5;&#x8DF3;&#x8FC7;&#x7F3A;&#x5931;&#x503C;&#x76F4;&#x63A5;&#x8FDB;&#x884C;&#x8FD0;&#x7B97;</p>
<p>&#x8DF3;&#x8FC7;&#x7F3A;&#x5931;&#x503C;&#x76F4;&#x63A5;&#x8FD0;&#x7B97;</p>
<pre><code class="lang-python">d = pd.Series([<span class="hljs-number">2</span>,<span class="hljs-number">4</span>,np.nan,<span class="hljs-number">8</span>,<span class="hljs-keyword">None</span>,<span class="hljs-number">12</span>])
d
</code></pre>
<pre><code>0     2.0
1     4.0
2     NaN
3     8.0
4     NaN
5    12.0
dtype: float64
</code></pre><pre><code class="lang-python">d + <span class="hljs-number">10</span>
</code></pre>
<pre><code>0    12.0
1    14.0
2     NaN
3    18.0
4     NaN
5    22.0
dtype: float64
</code></pre><pre><code class="lang-python">d.sum() / <span class="hljs-number">4</span>
</code></pre>
<pre><code>6.5
</code></pre><pre><code class="lang-python">d.mean()
</code></pre>
<pre><code>6.5
</code></pre><pre><code class="lang-python">d[<span class="hljs-number">0</span>] = np.nan
d
</code></pre>
<pre><code>0     NaN
1     4.0
2     NaN
3     8.0
4     NaN
5    12.0
dtype: float64
</code></pre><pre><code class="lang-python">
c = pd.DataFrame([[<span class="hljs-number">1</span>,np.nan,<span class="hljs-number">3</span>], [<span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>], [np.nan, <span class="hljs-number">8</span>,<span class="hljs-number">9</span>]])
c
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.sum()
</code></pre>
<pre><code>0     5.0
1    13.0
2    18.0
dtype: float64
</code></pre><h3 id="&#x901A;&#x8FC7;&#x51FD;&#x6570;&#x68C0;&#x67E5;&#x6570;&#x636E;&#x4E2D;&#x662F;&#x5426;&#x6709;&#x7F3A;&#x5931;&#x503C;">&#x901A;&#x8FC7;&#x51FD;&#x6570;&#x68C0;&#x67E5;&#x6570;&#x636E;&#x4E2D;&#x662F;&#x5426;&#x6709;&#x7F3A;&#x5931;&#x503C;</h3>
<pre><code class="lang-python">d
</code></pre>
<pre><code>0     NaN
1     4.0
2     NaN
3     8.0
4     NaN
5    12.0
dtype: float64
</code></pre><pre><code class="lang-python">c
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.info()
</code></pre>
<pre><code>&lt;class &apos;pandas.core.frame.DataFrame&apos;&gt;
RangeIndex: 3 entries, 0 to 2
Data columns (total 3 columns):
0    2 non-null float64
1    2 non-null float64
2    3 non-null int64
dtypes: float64(2), int64(1)
memory usage: 152.0 bytes
</code></pre><p>isnull() &#x548C; notnull()</p>
<ul>
<li>isnull():&#x7F3A;&#x5931;&#x503C;&#x8FD4;&#x56DE;True&#xFF0C;&#x6B63;&#x5E38;&#x503C;&#x8FD4;&#x56DE;False</li>
<li>notnull():&#x6B63;&#x5E38;&#x503C;&#x8FD4;&#x56DE;True&#xFF0C;&#x7F3A;&#x5931;&#x503C;&#x8FD4;&#x56DE;False</li>
</ul>
<pre><code class="lang-python">d
</code></pre>
<pre><code>0     NaN
1     4.0
2     NaN
3     8.0
4     NaN
5    12.0
dtype: float64
</code></pre><pre><code class="lang-python">d.isnull()  <span class="hljs-comment">#&#x7F3A;&#x5931;&#x503C;&#x8FD4;&#x56DE;True</span>
</code></pre>
<pre><code>0     True
1    False
2     True
3    False
4     True
5    False
dtype: bool
</code></pre><pre><code class="lang-python">-(d.isnull())  <span class="hljs-comment"># &#x975E;&#x8FD0;&#x7B97;</span>
</code></pre>
<pre><code>0    False
1     True
2    False
3     True
4    False
5     True
dtype: bool
</code></pre><pre><code class="lang-python">d.notnull()  <span class="hljs-comment">#&#x7F3A;&#x5931;&#x503C;&#x8FD4;&#x56DE;False</span>
</code></pre>
<pre><code>0    False
1     True
2    False
3     True
4    False
5     True
dtype: bool
</code></pre><p>&#x8FD4;&#x56DE;&#x6240;&#x6709;&#x6B63;&#x5E38;&#x503C;</p>
<p>&#x624B;&#x52A8;&#x8FC7;&#x6EE4;Series &#x7684;&#x7F3A;&#x5931;&#x503C;</p>
<pre><code class="lang-python">d[d.notnull()]
</code></pre>
<pre><code>1     4.0
3     8.0
5    12.0
dtype: float64
</code></pre><p>DataFrame &#x4E0D;&#x80FD;&#x901A;&#x8FC7;&#x5E03;&#x5C14;&#x67E5;&#x8BE2;&#x65B9;&#x5F0F;&#x8FC7;&#x6EE4;&#x7F3A;&#x5931;&#x503C;&#xFF0C;&#x5FC5;&#x987B;&#x4F7F;&#x7528;Pandas&#x7684;&#x5F85;&#x5B9A;&#x65B9;&#x6CD5;&#x8FC7;&#x6EE4;</p>
<p>&#x67E5;&#x5230;&#x7F3A;&#x5931;&#x503C;&#x540E;&#xFF0C;Series &#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x8FC7;&#x6EE4;&#xFF0C;DataFrame&#x9700;&#x8981;&#x8FDB;&#x4E00;&#x6B65;&#x5904;&#x7406;</p>
<pre><code class="lang-python">c
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c[c.notnull()]
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c[c.isnull()]  <span class="hljs-comment">#  &#x662F;&#x7A7A;&#x503C;&#x7684; &#x8FD4;&#x56DE; true  &#x4E0D;&#x662F;&#x7A7A;&#x7684; &#x662F; False&#xFF0C;&#x7136;&#x540E; &#x5E03;&#x5C14;&#x67E5;&#x8BE2;&#x4EE5;&#x540E;b &#xFF0C; &#x662F;&#x7A7A;&#x503C;&#x7684; &#x90A3;&#x4E48;&#x6570;&#x636E;&#x5C31;&#x662F;Nan&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x7A7A;&#x503C;&#x7684;&#x8FD4;&#x56DE;&#x7684;&#x662F;Nan&#x3002;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>



<h3 id="&#x53BB;&#x9664;&#x7F3A;&#x5931;&#x503C;&#xFF0C;&#x53EA;&#x4FDD;&#x7559;&#x6709;&#x6548;&#x503C;">&#x53BB;&#x9664;&#x7F3A;&#x5931;&#x503C;&#xFF0C;&#x53EA;&#x4FDD;&#x7559;&#x6709;&#x6548;&#x503C;</h3>
<p>dropna() &#x51FD;&#x6570;</p>
<pre><code class="lang-python">d
</code></pre>
<pre><code>0     NaN
1     4.0
2     NaN
3     8.0
4     NaN
5    12.0
dtype: float64
</code></pre><pre><code class="lang-python">d.dropna()
</code></pre>
<pre><code>1     4.0
3     8.0
5    12.0
dtype: float64
</code></pre><pre><code class="lang-python"><span class="hljs-comment"># &#x7B49;&#x540C;&#x4E8E;</span>
d[d.notnull()]
</code></pre>
<pre><code>1     4.0
3     8.0
5    12.0
dtype: float64
</code></pre><pre><code class="lang-python">c
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.dropna()  <span class="hljs-comment">#&#x9ED8;&#x8BA4;&#x5220;&#x9664;&#x7F3A;&#x5931;&#x503C;&#x6240;&#x5728;&#x884C;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.dropna(axis=<span class="hljs-number">0</span>)  <span class="hljs-comment">#&#x9ED8;&#x8BA4;&#x5220;&#x9664;&#x7F3A;&#x5931;&#x503C;&#x6240;&#x5728;&#x884C;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.dropna(axis=<span class="hljs-number">1</span>)  <span class="hljs-comment">#&#x6309;&#x5217;&#x5220;&#x9664;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>3</td>
    </tr>
    <tr>
      <th>1</th>
      <td>6</td>
    </tr>
    <tr>
      <th>2</th>
      <td>9</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python"><span class="hljs-comment">#&#x589E;&#x52A0;&#x4E00;&#x5217; &#x5168;&#x90E8;&#x4E3A;&#x7F3A;&#x5931;&#x503C;&#x7684;&#x6570;&#x636E;</span>
c[<span class="hljs-number">3</span>] = np.nan
c
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python"><span class="hljs-comment"># &#x884C;&#x6216; &#x5217;&#xFF0C; &#x6709;1 &#x4E2A;&#x7F3A;&#x5931;&#x503C;&#x5373;&#x5220;&#x9664;</span>
c.dropna(axis=<span class="hljs-number">1</span>)
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>3</td>
    </tr>
    <tr>
      <th>1</th>
      <td>6</td>
    </tr>
    <tr>
      <th>2</th>
      <td>9</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python"><span class="hljs-comment">#&#x7B49;&#x540C;</span>
c.dropna(axis=<span class="hljs-number">1</span>, how=<span class="hljs-string">&apos;any&apos;</span>)
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>3</td>
    </tr>
    <tr>
      <th>1</th>
      <td>6</td>
    </tr>
    <tr>
      <th>2</th>
      <td>9</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.dropna(axis=<span class="hljs-number">1</span>, how=<span class="hljs-string">&apos;all&apos;</span>)  <span class="hljs-comment"># &#x884C;&#x6216;&#x5217;&#x5FC5;&#x987B;&#x5168;&#x90E8;&#x90FD;&#x662F;&#x7F3A;&#x5931;&#x503C;&#x624D;&#x5220;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9</td>
    </tr>
  </tbody>
</table>
</div>



<h3 id="&#x6839;&#x636E;&#x884C;&#x6216;&#x5217;&#x7684;&#x975E;&#x7F3A;&#x5931;&#x503C;&#x6570;&#x91CF;&#x8861;&#x91CF;&#x5220;&#x9664;&#x4E0E;&#x5426;">&#x6839;&#x636E;&#x884C;&#x6216;&#x5217;&#x7684;&#x975E;&#x7F3A;&#x5931;&#x503C;&#x6570;&#x91CF;&#x8861;&#x91CF;&#x5220;&#x9664;&#x4E0E;&#x5426;</h3>
<pre><code class="lang-python">c
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.dropna()
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.dropna(thresh=<span class="hljs-number">3</span>)  <span class="hljs-comment"># &#x884C;&#x975E;&#x7F3A;&#x5931;&#x503C;&#x6570;&#x91CF;&#x5927;&#x4E8E;&#x7B49;&#x4E8E;3&#x4E2A;&#xFF0C;&#x4FDD;&#x7559;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>



<h2 id="&#x586B;&#x5145;&#x7F3A;&#x5931;&#x503C;&#xB6;">&#x586B;&#x5145;&#x7F3A;&#x5931;&#x503C;&#xB6;</h2>
<p>&#x7F3A;&#x5931;&#x503C;&#x95EE;&#x9898;&#x9664;&#x4E86;&#x5220;&#x9664;&#x6240;&#x5728;&#x884C;&#x5217;&#x4EE5;&#x5916;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x586B;&#x5145;&#x503C;&#x89E3;&#x51B3;</p>
<p>fillna()&#x51FD;&#x6570;&#x53C2;&#x6570;</p>
<pre><code class="lang-python">d
</code></pre>
<pre><code>0     NaN
1     4.0
2     NaN
3     8.0
4     NaN
5    12.0
dtype: float64
</code></pre><pre><code class="lang-python">d.fillna(<span class="hljs-number">0</span>)   <span class="hljs-comment"># &#x7F3A;&#x5931;&#x503C;&#x586B;&#x5145;0</span>
</code></pre>
<pre><code>0     0.0
1     4.0
2     0.0
3     8.0
4     0.0
5    12.0
dtype: float64
</code></pre><pre><code class="lang-python">d.fillna(d.mean())  <span class="hljs-comment">#&#x586B;&#x5145;&#x5747;&#x503C;</span>
</code></pre>
<pre><code>0     8.0
1     4.0
2     8.0
3     8.0
4     8.0
5    12.0
dtype: float64
</code></pre><h3 id="&#x524D;&#x5411;&#x586B;&#x5145;&#x548C;&#x540E;&#x5411;&#x586B;&#x5145;&#xB6;">&#x524D;&#x5411;&#x586B;&#x5145;&#x548C;&#x540E;&#x5411;&#x586B;&#x5145;&#xB6;</h3>
<p>method=&apos;ffill&apos;</p>
<p>method=&apos;bfill&apos;</p>
<pre><code class="lang-python">d
</code></pre>
<pre><code>0     NaN
1     4.0
2     NaN
3     8.0
4     NaN
5    12.0
dtype: float64
</code></pre><pre><code class="lang-python">d.fillna(<span class="hljs-number">0</span>)
</code></pre>
<pre><code>0     0.0
1     4.0
2     0.0
3     8.0
4     0.0
5    12.0
dtype: float64
</code></pre><h3 id="&#x524D;&#x5411;&#x586B;&#x5145;&#xFF1A;&#x4F7F;&#x7528;&#x7F3A;&#x5931;&#x503C;&#x7684;&#x524D;&#x4E00;&#x4E2A;&#x503C;&#x586B;&#x5145;">&#x524D;&#x5411;&#x586B;&#x5145;&#xFF1A;&#x4F7F;&#x7528;&#x7F3A;&#x5931;&#x503C;&#x7684;&#x524D;&#x4E00;&#x4E2A;&#x503C;&#x586B;&#x5145;</h3>
<pre><code class="lang-python">d.fillna(method=<span class="hljs-string">&apos;ffill&apos;</span>)
</code></pre>
<pre><code>0     NaN
1     4.0
2     4.0
3     8.0
4     8.0
5    12.0
dtype: float64
</code></pre><h3 id="&#x540E;&#x5411;&#x586B;&#x5145;&#xFF0C;&#x4F7F;&#x7528;&#x7F3A;&#x5931;&#x503C;&#x7684;&#x540E;&#x4E00;&#x4E2A;&#x503C;&#x586B;&#x5145;">&#x540E;&#x5411;&#x586B;&#x5145;&#xFF0C;&#x4F7F;&#x7528;&#x7F3A;&#x5931;&#x503C;&#x7684;&#x540E;&#x4E00;&#x4E2A;&#x503C;&#x586B;&#x5145;</h3>
<pre><code class="lang-python">d.fillna(method=<span class="hljs-string">&apos;bfill&apos;</span>)
</code></pre>
<pre><code>0     4.0
1     4.0
2     8.0
3     8.0
4    12.0
5    12.0
dtype: float64
</code></pre><pre><code class="lang-python">c
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.fillna(method=<span class="hljs-string">&apos;ffill&apos;</span>)  <span class="hljs-comment"># &#x524D;&#x5411;&#x586B;&#x5145;&#xFF0C;&#x6309;&#x884C;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>4.0</td>
      <td>8.0</td>
      <td>9</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.fillna(axis=<span class="hljs-number">1</span>, method=<span class="hljs-string">&apos;ffill&apos;</span>)  <span class="hljs-comment"># &#x524D;&#x5411;&#x586B;&#x5145;&#xFF0C;&#x6309;&#x5217;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>1.0</td>
      <td>3.0</td>
      <td>3.0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6.0</td>
      <td>6.0</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9.0</td>
      <td>9.0</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.fillna(axis=<span class="hljs-number">1</span>, method=<span class="hljs-string">&apos;ffill&apos;</span>)  <span class="hljs-comment"># &#x524D;&#x5411;&#x586B;&#x5145;&#xFF0C;&#x6309;&#x5217;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>1.0</td>
      <td>3.0</td>
      <td>3.0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6.0</td>
      <td>6.0</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9.0</td>
      <td>9.0</td>
    </tr>
  </tbody>
</table>
</div>



<p>&#x7ED9;&#x5404;&#x5217;&#x5206;&#x5E03;&#x586B;&#x5145;&#x4E0D;&#x540C;&#x503C;</p>
<pre><code class="lang-python">c
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.fillna({<span class="hljs-number">0</span>:<span class="hljs-number">100</span>, <span class="hljs-number">1</span>:<span class="hljs-number">200</span>,<span class="hljs-number">3</span>:<span class="hljs-number">300</span>})
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>200.0</td>
      <td>3</td>
      <td>300.0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
      <td>300.0</td>
    </tr>
    <tr>
      <th>2</th>
      <td>100.0</td>
      <td>8.0</td>
      <td>9</td>
      <td>300.0</td>
    </tr>
  </tbody>
</table>
</div>



<p>&#x4E0A;&#x9762;&#x4E00;&#x5207;&#x5220;&#x9664;&#xFF0C;&#x586B;&#x5145;&#x64CD;&#x4F5C;&#x90FD;&#x6CA1;&#x6709;&#x4FEE;&#x6539;&#x539F;&#x53D8;&#x91CF;</p>
<p>&#x4FEE;&#x6539;&#x539F;&#x53D8;&#x91CF;&#xFF1A;inplace = True</p>
<pre><code class="lang-python">c
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.fillna(<span class="hljs-number">100</span>,inplace=<span class="hljs-keyword">True</span>)
</code></pre>
<pre><code class="lang-python">c
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>100.0</td>
      <td>3</td>
      <td>100.0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>5.0</td>
      <td>6</td>
      <td>100.0</td>
    </tr>
    <tr>
      <th>2</th>
      <td>100.0</td>
      <td>8.0</td>
      <td>9</td>
      <td>100.0</td>
    </tr>
  </tbody>
</table>
</div>



<p>&#x8FDE;&#x7EED;&#x586B;&#x5145;&#x6570;&#x91CF;</p>
<pre><code class="lang-python">c.loc[<span class="hljs-number">3</span>] = np.nan
c.loc[<span class="hljs-number">0</span>,<span class="hljs-number">1</span>] = np.nan
c.loc[<span class="hljs-number">1</span>:<span class="hljs-number">3</span>,<span class="hljs-number">0</span>] = np.nan
c[<span class="hljs-number">3</span>] = np.nan
c
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3.0</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>NaN</td>
      <td>5.0</td>
      <td>6.0</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9.0</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>3</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.fillna(method=<span class="hljs-string">&apos;ffill&apos;</span>)  <span class="hljs-comment">#&#x9ED8;&#x8BA4;&#x5168;&#x90E8;&#x586B;&#x5145;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3.0</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>1.0</td>
      <td>5.0</td>
      <td>6.0</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>1.0</td>
      <td>8.0</td>
      <td>9.0</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>3</th>
      <td>1.0</td>
      <td>8.0</td>
      <td>9.0</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">c.fillna(method=<span class="hljs-string">&apos;ffill&apos;</span>, limit=<span class="hljs-number">2</span>)  <span class="hljs-comment"># &#x8BBE;&#x7F6E;&#x586B;&#x5145;&#x591A;&#x5C11;&#x884C;&#x6216;&#x5217;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.0</td>
      <td>NaN</td>
      <td>3.0</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>1.0</td>
      <td>5.0</td>
      <td>6.0</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>1.0</td>
      <td>8.0</td>
      <td>9.0</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>3</th>
      <td>NaN</td>
      <td>8.0</td>
      <td>9.0</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>



<h1 id="&#x66FF;&#x6362;&#x503C;">&#x66FF;&#x6362;&#x503C;</h1>
<p>&#x5229;&#x7528;fillna&#x65B9;&#x6CD5;&#x586B;&#x5145;&#x7F3A;&#x5931;&#x6570;&#x636E;&#x662F;&#x503C;&#x66FF;&#x6362;&#x7684;&#x4E00;&#x79CD;&#x7279;&#x6B8A;&#x60C5;&#x51B5;&#xFF0C; replace&#x65B9;&#x6CD5;&#x7528;&#x4F5C;&#x66FF;&#x6362;&#x503C;&#x66F4;&#x7B80;&#x5355;&#x3001;&#x66F4;&#x7075;&#x6D3B;</p>
<pre><code class="lang-python">data = pd.Series([<span class="hljs-number">1</span>,-<span class="hljs-number">999</span>,<span class="hljs-number">2</span>,-<span class="hljs-number">999</span>,-<span class="hljs-number">1000</span>,<span class="hljs-number">3</span>])
data
</code></pre>
<pre><code>0       1
1    -999
2       2
3    -999
4   -1000
5       3
dtype: int64
</code></pre><pre><code class="lang-python"><span class="hljs-comment"># &#x66FF;&#x6362;&#x5355;&#x503C;</span>
data.replace(-<span class="hljs-number">999</span>, np.nan)
</code></pre>
<pre><code>0       1.0
1       NaN
2       2.0
3       NaN
4   -1000.0
5       3.0
dtype: float64
</code></pre><pre><code class="lang-python"><span class="hljs-comment"># &#x66FF;&#x6362;&#x591A;&#x503C;</span>
data.replace([-<span class="hljs-number">999</span>, -<span class="hljs-number">1000</span>], np.nan)
</code></pre>
<pre><code>0    1.0
1    NaN
2    2.0
3    NaN
4    NaN
5    3.0
dtype: float64
</code></pre><pre><code class="lang-python"><span class="hljs-comment"># &#x591A;&#x4E2A;&#x503C;&#x66FF;&#x6362;&#x4E3A;&#x4E0D;&#x540C;&#x6570;&#x503C;</span>
data.replace([-<span class="hljs-number">999</span>, -<span class="hljs-number">1000</span>], [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>])
data.replace({-<span class="hljs-number">999</span>: <span class="hljs-number">0</span>, -<span class="hljs-number">1000</span>: <span class="hljs-number">1</span>})
</code></pre>
<pre><code>0    1
1    0
2    2
3    0
4    1
5    3
dtype: int64
</code></pre><h3 id="&#x6620;&#x5C04;&#x6570;&#x636E;&#x66FF;&#x6362;">&#x6620;&#x5C04;&#x6570;&#x636E;&#x66FF;&#x6362;</h3>
<p>map&#x9664;&#x4E86;&#x81EA;&#x5B9A;&#x4E49;&#x51FD;&#x6570;&#x8FD0;&#x7B97;&#xFF0C;&#x8FD8;&#x662F;&#x4E00;&#x79CD;&#x6620;&#x5C04;&#x8F6C;&#x6362;&#x5143;&#x7D20;&#x4EE5;&#x53CA;&#x5176;&#x4ED6;&#x6570;&#x636E;&#x6E05;&#x7406;&#x5DE5;&#x4F5C;&#x7684;&#x4FBF;&#x6377;&#x65B9;&#x5F0F;</p>
<pre><code class="lang-python">a = pd.DataFrame([[<span class="hljs-string">&apos;&#x9B03;&#x5237;&apos;</span>,<span class="hljs-string">&apos;&#x76AE;&#x5E26;&apos;</span>,<span class="hljs-string">&apos;&#x714E;&#x86CB;&apos;</span>,<span class="hljs-string">&apos;&#x89C2;&#x8D4F;&apos;</span>], [<span class="hljs-number">10</span>,<span class="hljs-number">20</span>,<span class="hljs-number">30</span>,<span class="hljs-number">40</span>]]).T
a
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>&#x9B03;&#x5237;</td>
      <td>10</td>
    </tr>
    <tr>
      <th>1</th>
      <td>&#x76AE;&#x5E26;</td>
      <td>20</td>
    </tr>
    <tr>
      <th>2</th>
      <td>&#x714E;&#x86CB;</td>
      <td>30</td>
    </tr>
    <tr>
      <th>3</th>
      <td>&#x89C2;&#x8D4F;</td>
      <td>40</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">y = {<span class="hljs-string">&apos;&#x9B03;&#x5237;&apos;</span>: <span class="hljs-string">&apos;&#x732A;&apos;</span>, <span class="hljs-string">&apos;&#x76AE;&#x5E26;&apos;</span>: <span class="hljs-string">&apos;&#x725B;&apos;</span>, <span class="hljs-string">&apos;&#x89C2;&#x8D4F;&apos;</span>: <span class="hljs-string">&apos;&#x9C7C;&apos;</span>, <span class="hljs-string">&apos;&#x8863;&#x670D;&apos;</span>: <span class="hljs-string">&apos;&#x68C9;&#x82B1;&apos;</span>}
</code></pre>
<pre><code class="lang-python">a[<span class="hljs-number">0</span>].map(y)
</code></pre>
<pre><code>0      &#x732A;
1      &#x725B;
2    NaN
3      &#x9C7C;
Name: 0, dtype: object
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../数据分析库的操作/9Pandas分组聚合2.html" class="navigation navigation-prev " aria-label="Previous page: Pandas分组聚合2"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../数据分析库的操作/11Pandas数据规整-转换.html" class="navigation navigation-next " aria-label="Next page: Pandas数据规整-转换"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
